﻿using System.Runtime.Serialization;
using UFIDA.U9.Cust.Pub.WS.Base.Interfaces;
using UFIDA.U9.WSS.ProxyService.Exceptions;

namespace UFIDA.U9.WSS.ProxyService.Models
{
    [DataContract]
    public class ReturnMessage<T> : IReturnMessage
    {
        /// <summary>
        ///     构造器
        /// </summary>
        public ReturnMessage()
        {
        }

        /// <summary>
        ///     构造器
        /// </summary>
        /// <param name="data"></param>
        public ReturnMessage(T data)
        {
            Data = data;
        }

        /// <summary>
        ///     返回结果
        /// </summary>
        [DataMember]
        public T Data { get; set; }

        /// <summary>
        ///     编码
        /// </summary>
        [DataMember]
        public int Code { get; set; } = ExceptionCodes.Success;

        /// <summary>
        ///     是否成功
        /// </summary>
        [DataMember]
        public bool IsSuccess { get; set; } = true;

        /// <summary>
        ///     错误信息
        /// </summary>
        [DataMember]
        public string ErrMsg { get; set; } = string.Empty;

        /// <summary>
        ///     堆栈信息
        /// </summary>
        [DataMember]
        public string StackString { get; set; } = string.Empty;
    }
}